/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package view;

import controler.Controleur;
import modele.Joueur;

/**
 *
 * @author Vaïk
 */
public class FrameBuyProperty extends javax.swing.JDialog {

    Controleur controleur;
    /**
     * Creates new form FrameBuyProperty
     */
    public FrameBuyProperty(java.awt.Frame parent, boolean modal, Controleur c, String nom, int prix) {
        super(parent, modal);
        controleur = c;
        initComponents();
        jLabel1.setText("Voulez-vous acheter " + nom + " pour " + prix + "€ ?");
        setVisible(true);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jbNon = new javax.swing.JButton();
        jbOui = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Voulez-vous acheter la propriété ?");

        jbNon.setText("Non");
        jbNon.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbNonActionPerformed(evt);
            }
        });

        jbOui.setText("Oui");
        jbOui.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbOuiActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(119, Short.MAX_VALUE)
                .addComponent(jbNon)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jbOui)
                .addGap(135, 135, 135))
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 14, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jbNon)
                    .addComponent(jbOui))
                .addContainerGap())
        );

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void jbOuiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbOuiActionPerformed
        // TODO add your handling code here:
        setVisible(false);
        Joueur j = controleur.getJoueurCourant();
        j.getCaseCourante().effet(j, controleur.getPlateau());
        dispose();
    }//GEN-LAST:event_jbOuiActionPerformed

    private void jbNonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbNonActionPerformed
        // TODO add your handling code here:
        dispose();
    }//GEN-LAST:event_jbNonActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JButton jbNon;
    private javax.swing.JButton jbOui;
    // End of variables declaration//GEN-END:variables

    public javax.swing.JButton getJbNon()
    {
        return jbNon;
    }
    
    public javax.swing.JButton getJbOui()
    {
        return jbOui;
    }
}
